/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*-  */
/*
 * liberacus
 * Copyright (C) 2013 Massimiliano Maniscalco <massi.neptune@yahoo.com>
 * 
liberacus is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * liberacus is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _RICEVUTA_PRINT_FORM_OPERATION_H_
#define _RICEVUTA_PRINT_FORM_OPERATION_H_

#include <pangomm.h>
#include <gtkmm.h>

class RicevutaPrintFormOperation: public Gtk::PrintOperation
{
public:
	static Glib::RefPtr<RicevutaPrintFormOperation> create();
	virtual ~RicevutaPrintFormOperation();
	inline void set_intestazione ( const Glib::ustring &str ) { intestazione.assign(str); }
	inline void set_content ( const Glib::ustring &str ) { content.assign(str); }
	inline void set_saluto ( const Glib::ustring &str ) { saluto.assign(str); }

protected:
	RicevutaPrintFormOperation();

	virtual void on_begin_print(const Glib::RefPtr<Gtk::PrintContext>& context);
	virtual void on_draw_page(const Glib::RefPtr<Gtk::PrintContext>& context, int page_nr);

	Glib::RefPtr<Pango::Layout> m_refLayout;
	std::vector<int> m_PageBreaks; // line numbers where a page break occurs
private:
	Glib::ustring intestazione;
	Glib::ustring content;
	Glib::ustring saluto;

};

#endif // _RICEVUTA_PRINT_FORM_OPERATION_H_

